import shutil
from os import path
import os
import tarfile

#  shell util 连接用户软件  和 计算机操作系统的内核，负责通信
#  磁盘使用情况，use 使用 usage 名词使用
res = shutil.disk_usage('D:')
print(res)


#    copyfile
# res = path.dirname(__file__)
# print(res)
# D:/python/Demopycharm/Modules_study/shutil模块
# shutil.copyfile('D:/python/Demopycharm/嘤/嘤.py',r'D:/python/Demopycharm/Modules_study/shutil模块/copy_ying.py')  # src 源 source
     # 分隔符最后一位  当成复制后的文件名



#   move
# shutil.move('copy_ying.py',r'D:/python/Demopycharm/嘤')
#
# # src = '源文件名'
# # dst = '路径'
# shutil.move('D:/python/Demopycharm/嘤','嗯哼')
# 将 dst文件夹的名字  换成 src 并移动到当前文件夹下方


#   删除
todel = 'archive.zip'
shutil.rmtree(todel)
  # 可删有内容的文件夹

# tar_file = path.dirname(__file__)
# print(tar_file)
# print(shutil.get_archive_formats())
# shutil.make_archive('archive','zip')
# t = tarfile.open('archive.zip','r')
# t.extractall(tarfile)
# t.close()
# import tarfile
# t = tarfile.open('archive.zip','r')
# t.extractall()
# t.close()
# tar = tarfile.open("/tmp/test.tar.gz","r")
# for ti in tar:
#     tar.extract(ti,"/")
# tar.close()
